<script>
/**
 * Recent activity component
 */
import journalModal from "@/components/journalModal";
export default {
  components: {
    journalModal
  },
  props: {
    type: {
      value: Number
    }
  },
  data() {
    return {
      activityData: [
        {
          icon: "ri-bar-chart-fill",
          date: "",
          time: "刚刚",
          title: "ERROR  全球经济数据网_最新文章 - 请求异常"
        },
        {
          icon: "ri-calendar-2-fill",
          date: "",
          time: "1分钟前",
          title: "ERROR 快科技_资讯中心 - 请求超时"
        },
        {
          icon: "ri-edit-2-fill",
          date: "",
          time: "2分钟前",
          title: "ERROR 快科技_资讯中心: 404错误"
        },
        {
          icon: "ri-user-2-fill",
          date: "",
          time: "3分钟前",
          title: "ERROR  21经济网_全球市场 - 数据源ID为空"
        },
        {
          icon: "ri-user-2-fill",
          date: "",
          time: "15分钟前",
          title: "ERROR 36kr_科技 - 站点封禁"
        },
        {
          icon: "ri-user-2-fill",
          date: "",
          time: "30分钟前",
          title: "ERROR 澎湃新闻_财经 - 抓取执行节点[执行SQL:19]出错,异常信息：{}"
        },
        {
          icon: "ri-user-2-fill",
          date: "",
          time: "40分钟前",
          title: "ERROR 玉林市旅游局_通知公告 - URL地址无效"
        },
        {
          icon: "ri-user-2-fill",
          date: "",
          time: "1小时前",
          title: "ERROR 云掌财经_国内经济 - 栏目配置异常"
        },{
          icon: "ri-edit-2-fill",
          time: "1小时前",
          date: "",
          title: "ERROR 江苏省教育考试院_招考要闻栏目 - 500错误"
        },{
          icon: "ri-user-2-fill",
          date: "",
          time: "2小时前",
          title: "ERROR 第一财经_新闻 - 请求出错,异常信息:{}"
        }
      ],
      showModal: false,
      errorContent: `
                设置变量contenthtml出错，异常信息：{}
        org.spiderflow.core.expression.ExpressionError$TemplateException: Error (1): Couldn't call method 'json' with arguments '[<!DOCTYPE 
        html>
            at org.spiderflow.core.expression.ExpressionError.error(ExpressionError.java:53)
                at org.spiderflow.core.expression.parsing.Ast$MethodCall.evaluate(Ast.java:1227)
                at org.spiderflow.core.expression.parsing.Ast$MemberAccess.evaluate(Ast.java:915)
                at org.spiderflow.core.expression.interpreter.AstInterpreter.interpretNodeList(AstInterpreter.java:46)
                at org.spiderflow.core.expression.interpreter.AstInterpreter.interpret(AstInterpreter.java:31)
                at org.spiderflow.core.expression.ExpressionTemplate.render(ExpressionTemplate.java:36)
                at org.spiderflow.core.expression.DefaultExpressionEngine.execute(DefaultExpressionEngine.java:48)
                at org.spiderflow.core.utils.ExpressionUtils.execute(ExpressionUtils.java:56)
                at org.spiderflow.core.executor.shape.VariableExecutor.execute(VariableExecutor.java:76)
                at org.spiderflow.core.Spider.lambda$executeNode$4(Spider.java:341)
                at com.alibaba.ttl.TtlRunnable.run(TtlRunnable.java:55)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
                at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                at org.spiderflow.core.Spider.executeNode(Spider.java:377)
                at org.spiderflow.core.Spider.executeNextNodes(Spider.java:227)
                at org.spiderflow.core.Spider.lambda$executeRoot$3(Spider.java:189)
                at com.alibaba.ttl.TtlRunnable.run(TtlRunnable.java:55)
                at org.spiderflow.concurrent.SpiderFlowThreadPoolExecutor$SubThreadPoolExecutor.lambda$submitAsync$0(SpiderFlowThreadPoolExe
        cutor.java:152)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
                at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
                at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
                at java.lang.Thread.run(Thread.java:745)
        Caused by: java.lang.RuntimeException: Couldn't call method 'json' with arguments '[<!DOCTYPE html>
        <html lang="zh-cmn-Hans">
        <html lang="zh-cmn-Hans">
        <head>
      `,
    };
  },
  methods: {
    jump(){
      this.$router.push({
        path: '/log',
        query: {
          type: '信源',
          state: '异常'
        }
      })
    },
    logDetail(data){
      console.log(data);
      // this.showModal = true
      this.$refs.journalModal.open()
    },
  }
};
</script>

<template>
  <div class="card" >
    <div class="card-body" >
      <div class="float-right">
        <span style="cursor: pointer;">
          <i style="font-size: 18px;vertical-align: text-bottom;margin-right: 5px;" class="el-icon-refresh-right"></i>
        </span>
        
        <span @click="jump" class="pointer">
          <span>查看更多</span>
          <i style="font-size: 15px;vertical-align: bottom;" class="ri-arrow-right-s-line"></i>
        </span>
      </div>

      <h4 class="card-title mb-4" style="font-size: 17px;">
        <i style="font-size: 20px;vertical-align: sub;" class="ri-close-circle-line"></i>
        信源异常日志
      </h4>

      <div data-simplebar style="max-height:495px">
        <ul class="list-unstyled activity-wid" >
          <li class="activity-list" v-for="(data, index) in activityData" :key="index">
            <div class="activity-icon avatar-xs">
              <span class="avatar-title bg-soft-primary text-primary rounded-circle">
                <!-- <i :class="`${data.icon}`"></i> -->
                <i v-if="type==1" class="ri-bar-chart-fill"></i>
                <i v-if="type==2" class="ri-user-2-fill"></i>
                <i v-if="type==3" class="ri-edit-2-fill"></i>
              </span>
            </div>
            <div class="pointer" @click="logDetail(data)">
              <div>
                <h5 class="font-size-13">
                  {{data.date}}
                  <small class="text-muted">{{data.time}}</small>
                </h5>
              </div>

              <div>
                <p class="text-muted mb-0">{{data.title}}</p>
              </div>
            </div>
          </li>
        </ul>
      </div>
    </div>
    <journalModal ref="journalModal" />
  </div>
</template>
<style lang="scss" scoped>

</style>
